package com.chapter1;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class test3 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        char[] arr = s.toCharArray();
        List<Character> list = new ArrayList<>();
        for(char item : arr){
            list.add(item);
        }
        for(int i = 1; i < list.size()-1;i++){
            if(list.get(i-1) == list.get(i+1) && list.get(i) != list.get(i-1)){
                list.remove(i);
            }
        }
        int val = 1;
        int res = 1;
        for(int j = 1; j<list.size(); j++){
            if(list.get(j) == list.get(j-1)){
                val +=1;
            }else{
                val = 1;
            }
            res += val;
        }
        System.out.println(res);
    }


}
